package com.example.mybatisplusservice;

import com.baomidou.mybatisplus.core.override.MybatisMapperProxy;
import com.baomidou.mybatisplus.core.override.MybatisMapperProxyFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.mapper.MapperFactoryBean;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.AnnotationAsyncExecutionInterceptor;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
@EnableAsync
//代理对象暴露出来， 就可以使用AopContext.currentProxy()获取到代理对象
@EnableAspectJAutoProxy(exposeProxy = true)
@MapperScan("com.example.mybatisplusservice.mapper")
public class MybatisPlusServiceApplication {

    public static void main(String[] args) {

        /**
         * @See  org.springframework.scheduling.annotation.AnnotationAsyncExecutionInterceptor
         */
        //AnnotationAsyncExecutionInterceptor
        //MapperFactoryBean
        /**
         * public final List selectByUserId(Integer n) {
         *         try {
         *         //h==MybatisMapperProxy
         *             return (List)this.h.invoke(this, m3, new Object[]{n});
         *         }
         *         catch (Error | RuntimeException throwable) {
         *             throw throwable;
         *         }
         *         catch (Throwable throwable) {
         *             throw new UndeclaredThrowableException(throwable);
         *         }
         *     }
         */
        //MybatisMapperProxy  用于操作mapeer,包装在我们自定义的的mapper里面的h属性

        //生成 MybatisMapperProxy
        //MybatisMapperProxyFactory
        SpringApplication.run(MybatisPlusServiceApplication.class, args);

        //MethodInterceptor
    }

}
